#pragma once

#include "Table.h"
#include "Puck.h"

class Club
{
public:
	Club(irr::IrrlichtDevice* device, irr::scene::ISceneNode* table, 
		Puck* puck, bool invertControl = false);
	~Club(void);

	void update(int horDir, int verDir, int deltaX, int deltaY);
	
	irr::f32 getSpeed(void) 
	{ 
		return (lastPosition - node->getPosition()).getLength();
	}

	irr::core::vector3df getPosition(void)	
	{ 
		return node->getPosition();
	}

	irr::scene::ISceneNode* getNode(void)
	{ 
		return node;
	}

	void setPosition(irr::core::vector3df& position) 
	{ 
		node->setPosition(position);
	}

	bool collisionWithPuck(irr::core::vector3df& puckPosition, irr::core::vector3df& result, irr::f32& speed);

	static const irr::f32 RADIUS;

	enum HOR_DIR {HOR_NO = 0, LEFT = -1, RIGHT = 1};
	enum VER_DIR {VER_NO = 0, UP = -1, DOWN = 1};

private:
	irr::video::IVideoDriver* driver;
	irr::scene::ISceneManager* smgr;
	irr::scene::ISceneNode*	node;
	Puck* _puck;
	
	bool invert;

	irr::f32 speed;

	irr::core::vector3df direction;
	irr::core::vector3df position;
	irr::core::vector3df lastPosition;
	irr::core::vector3df lastPuckPosition;
};

